<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/1
 * Time: 16:06
 */
namespace USER;
require 'common_user.php';
require 'VIP1.php';
require 'VIP2.php';
require 'VIP3.php';
//$user=new common_user();
//$user->my_level();
//$user->online_num();
//$user1=new common_user();
//$user1->online_num();
//$user2=new common_user();
//$user2->online_num();
//$user3=new common_user();
//$user3->online_num();
class user
{  static public $user_arr;
    function create_user($level){
        switch ($level){
            case 0:
                $user=new  common_user();
                echo '<br/>';
                self::$user_arr[]=$user;
                $user->my_level();
                echo '拥有权力：';
                echo '<br/>';
                $user->register();
                $user->login();
                $user->updatepwd();
                $this->onlineuser_num();
                break;
            case 1:
                $vip1_user=new VIP1;
                self::$user_arr[]=$vip1_user;
                $vip1_user->my_level();
                echo '拥有权力：';
                echo '<br/>';
                $vip1_user->register();
                $vip1_user->login();
                $vip1_user->updatepwd();
                $vip1_user->ban_cryptonym();
                $this->onlineuser_num();
                break;
            case 2:
                $vip2_user=new VIP2;
                self::$user_arr[]=$vip2_user;
                $vip2_user->my_level();
                echo '拥有权力：';
                echo '<br/>';
                $vip2_user->register();
                $vip2_user->login();
                $vip2_user->updatepwd();
                $vip2_user->ban_cryptonym();
                $vip2_user->mute();
                $this->onlineuser_num();
                break;
            case 3:
                $vip3_user=new VIP3;
                self::$user_arr[]=$vip3_user;
                $vip3_user->my_level();
                echo '拥有权力：';
                echo '<br/>';
                $vip3_user->register();
                $vip3_user->login();
                $vip3_user->updatepwd();
                $vip3_user->ban_cryptonym();
                $vip3_user->mute();
                $vip3_user->kick_user();
                $this->onlineuser_num();
                break;
        }

    }
    function onlineuser_num(){
        echo '<br/>';
        echo '当前在线人数:'.count(self::$user_arr);
        echo '<br/>';
    }
}
$user=new  user();
$user->create_user(0);
$user->create_user(1);
$user->create_user(2);
$user->create_user(3);
$user->onlineuser_num();
//测试通过数组调用方法的可能性
$test=user::$user_arr[3];
$test->my_level();
echo '拥有权力：';
echo '<br/>';
$test->register();
$test->login();
$test->updatepwd();
$test->ban_cryptonym();
$test->mute();
$test->kick_user();


